//////////////////////////////////////////////////
// STUDENT RESEARCH PROJECT						//
// UNIVERSITY OF HAGEN 2012						//
// File:	EepromMemory.cpp					//
// Date:	25.09.2012							//
// Author:	Max Pejs							//
//////////////////////////////////////////////////

#include "EepromMemory.h"

void EepromMemory::write(UInt16 Adress, UInt16 Value)
{
	UInt8 val = (UInt8) (Value >> 8);
	EEPROM.write(Adress, val);
	val = (UInt8) (Value & 0x00FF);
	EEPROM.write(Adress + 1, val);
}

void EepromMemory::write(UInt16 Adress, UInt8 Value)
{
	EEPROM.write(Adress, (UInt8) Value);
}

UInt16 EepromMemory::readUInt16(UInt16 Adress)
{
	UInt16 ret = 0x0000;
	ret = EEPROM.read(Adress);
	ret = ret << 8;
	ret |= EEPROM.read(Adress + 1);
	return ret;
}

UInt8 EepromMemory::readUInt8(UInt16 Adress)
{
	return (UInt8)EEPROM.read(Adress);
}

